//
//  DB.m
//  geiTA
//
//  Created by 杨元龙 on 14-11-20.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "DB.h"
#import <sqlite3.h>
static sqlite3 *dbpoint = nil;

@implementation DB

+ (sqlite3 *)shareDataBase
{
    if (dbpoint) {
        return dbpoint;
    }
    NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *path = [array lastObject];
    path  = [NSString stringWithFormat:@"%@/geiTA.db",path];
    NSFileManager *manger = [NSFileManager defaultManager];
    
    BOOL judge = [manger fileExistsAtPath:path];
    if (!judge) {
        NSString *sourcePath =[[NSBundle mainBundle]pathForResource:@"geiTA" ofType:@"rdb"];
        [manger copyItemAtPath:sourcePath toPath:path error:nil];
        
    }
    
    sqlite3_open([path UTF8String], &dbpoint);
    NSLog(@"%@",path);
    return dbpoint;
    
}

// 获取图片路径




@end
